package com.springboot.wisdom.serviceApi.system.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.springboot.wisdom.common.common.constant.UserTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Date;
import java.util.List;

@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_role")
public class RoleDO {
    private static final long serialVersionUID = 1L;

    /**
     * ID。
     */
    @TableId(type = IdType.ASSIGN_ID)
    private String roleId;
    private String roleName;
    //    @TableField(typeHandler = EnumTypeHandler.class)
    private UserTypeEnum roleType;
    private String permissions;
    private String remark;
    // 菜单权限列表。
//    @TableField(typeHandler = FastjsonTypeHandler.class)
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> menuPermissions;

    private String createBy;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
}